package atm

import "fmt"

func ObjectDemo() {

	var muxiaohan person
	muxiaohan.name = "慕筱晗"
	muxiaohan.height = 186
	muxiaohan.weight = 129
	muxiaohan.money = 100
	muxiaohan.shangke("上课", "罗老师")
	muxiaohan.weizhi("信科楼", "607")

	var liuhuaiyuan person
	liuhuaiyuan.name = "柳槐鸢"
	liuhuaiyuan.height = 177
	liuhuaiyuan.weight = 115
	liuhuaiyuan.money = 80
	liuhuaiyuan.shangke("上课", "罗老师")
	liuhuaiyuan.weizhi("信科楼", "607")

	var wangdengcan person
	wangdengcan.name = "汪登灿"
	wangdengcan.height = 167
	wangdengcan.weight = 120
	wangdengcan.money = 160
	wangdengcan.shangke("上课", "罗老师")
	wangdengcan.weizhi("信科楼", "607")

	var wdc student
	wdc.name = "汪登灿"
	wdc.height = 167
	wdc.weight = 120
	wdc.xuehao = "2022022305"
	wdc.qingshi = "316"
	wdc.study()

	var yyx yunStudent
	yyx.name = "余颖欣"
	yyx.weight = 99
	yyx.height = 168
	yyx.xueyuan = "人工智能学院"
	yyx.banji = "云计算2班"

	fmt.Println(muxiaohan.name, "现在的钱是:", muxiaohan.money)
	fmt.Println(liuhuaiyuan.name, "现在的钱是:", liuhuaiyuan.money)
	fmt.Println(wangdengcan.name, "现在的钱是:", wangdengcan.money)
	fmt.Println(yyx.name, "她的名字是:", yyx.name)
	fmt.Println(wdc.name, "他的寝室是:", wdc.qingshi)
	fmt.Println(yyx.name, "她的身高是:", yyx.height, "她的体重是:",
		yyx.weight, "她的学院是:", yyx.xueyuan, "她的班级是:", yyx.banji)
	fmt.Println(yyx.student)
	wangdengcan.zhuanzhang(&muxiaohan, 55)

	for i := 0; i < 1; i++ {
		var edu float32
		fmt.Scanln(&edu)
		muxiaohan.fahongbao(edu, &liuhuaiyuan)
		fmt.Println(muxiaohan.name, "现在的钱是", muxiaohan.money)
		fmt.Println(liuhuaiyuan.name, "现在的钱是", liuhuaiyuan.money)
		fmt.Println(wangdengcan.name, "现在的钱是", wangdengcan.money)
		fmt.Println(yyx.name, "她的名字是:", yyx.name)
		fmt.Println(wdc.name, "他的身高是:", wdc.height, "他的体重是:",
			wdc.weight, "他的学号是:", wdc.xuehao, "他的寝室是:", wdc.qingshi)
	}
}

type person struct {
	// 身高
	height float32
	// 重量
	weight float32
	// 名字
	name string
	// 钱
	money float32
}

type student struct {
	person
	xuehao  string
	qingshi string
}

func (s *student) study() {
	fmt.Println(s.name, "可以学习")

}

type yunZhuji struct {
	person
	yunZhuji1 string
	yunZhuji2 string
	yunZhuji3 string
}

type yunStudent struct {
	student
	xueyuan string
	banji   string
}

func (s *yunStudent) yunstudy() {
	fmt.Println("云计算")

}

func (p *person) fahongbao(edu float32, mubiao ...*person) {
	p.money = p.money - edu*float32(len(mubiao))

	for i := 0; i < len(mubiao); i++ {
		mubiao[i].money += edu

	}
}
func (p *person) zhuanzhang(to *person, edu float32) bool {

	p.money = p.money - edu - edu*0.01
	to.money = to.money + edu - edu*0.01
	return true

}

// 上课
func (p person) shangke(address string, what string) {
	fmt.Println(p.name, "上课中", p.height, p.weight)
	fmt.Println(p.name, "在干什么：", address, "老师:", what)
}
func (p person) weizhi(address string, what string) {
	fmt.Println(p.name, "信科楼607")
	fmt.Println(p.name, "楼是：", address, "教室是：", what)
}
